@extends('template.base')
@section('content')
  <div class="btn-group btn-group-justified" style="margin-bottom:5px">
          <div class="btn-group">
                <a href="{{URL::to('/')}}"><button class="btn btn-success2 btn-md" >Beranda</button></a>
          </div>
          <div class="btn-group">
                <a href="{{URL::to('cekorder')}}"><button class="btn btn-success2 btn-md active">Cek order</button></a>
          </div>
          <div class="btn-group">
                <button class="btn btn-success2 btn-md" >Cara order</button>
          </div>
          <div class="btn-group">
                <button class="btn btn-success2 btn-md" >Kontak kami</button>
          </div>
  </div>

<div class="container-home" style="margin-bottom:5px;">
  <div align="center" >
      <h2><label>ORDER STATUS</label></h2>
     <div class="col-md-10 col-md-offset-1">


        @if($oc=='')
          <div align="center">
            <h2>Maaf pesanan tidak ditemukan</h2>
              <h5>Silahkan cek kembali nomor pesanan anda<br>
              Terima kasih<br><br></h5>
            
          </div>

        @else
       <div align="left">


        <?php
        if($order->order_name=='idcard'){
          $type = DB::table('sys_order_idcard')
                    ->where('order_idcard_order_id','=',$order->order_id)
                    ->first();
          $ordername = 'ID Card ('.$type->order_idcard_quality_name.')';
        }
        else if($order->order_name=='packaging'){
          $ordername = 'Packaging';
        }
        else if($order->order_name=='brochure'){
          $type = DB::table('sys_order_brochure')
                        ->where('order_brochure_order_id','=',$order->order_id)
                        ->first();
          if($type->order_brochure_type=="brochure"){
          $ordername = 'Brosur (Brosur)';
          }else if($type->order_brochure_type=="envelope"){
          $ordername = 'Brosur (Amplop)';
          }else if($type->order_brochure_type=="flayer"){
          $ordername = 'Brosur (Flayer)';
          }else if($type->order_brochure_type=="letterhead"){
          $ordername = 'Brosur (Kop Surat)';
          }
        }
        else if($order->order_name=='nota'){
          $type = DB::table('sys_order_bill')
                        ->where('order_bill_order_id','=',$order->order_id)
                        ->first();
          $ordername = $type->order_bill_name;
        }
        else if($order->order_name=='tshirt'){
           $type = DB::table('sys_order_tshirt')
                        ->join('ref_tshirt_detail','tshirt_detail_id','=','order_tshirt_tshirt_id')
                        ->join('ref_tshirt','tshirt_id','=','tshirt_detail_tshirt_id')
                        ->where('order_tshirt_order_id','=',$order->order_id)
                        ->first();
          $ordername = 'T-Shirt ('.$type->tshirt_type_of_material.')';
        }
         ?>
                              
                          <div class="row" style="margin-top:5px">
                          <div class="col-md-8 col-md-offset-2">
                            <br>
                            <label>Data pemesan</label>
                            <legend></legend>
                            <div class="row">
                            <div class="col-md-12">
                            <div class="row">
                              <div class="col-md-4">
                                  Nama pemesan
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$order->customer_name}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Alamat pemesan
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$order->customer_address}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Nomor telepon
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$order->customer_phone}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Alamat email
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$order->customer_email}}</label>
                              </div>
                              <br>
                              <br>
                            </div>
                            </div>
                            </div>
                            <br>


                              <label>Status pesanan</label>
                            <legend></legend>
                            <div class="row">
                            <div class="col-md-12">
                            <div class="row">

                               <div class="col-md-4">
                                  Status
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$order->order_status}}</label>
                              </div>
                              <br>
                              <br>


                                <div class="col-md-4">
                                  Total harga
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                                @if($order->invoice_total_payment=="")
                              <label>Belum ditentukan</label>
                                @else
                              <label>Rp {{number_format($order->invoice_total_payment,0,'.','.')}}</label>
                                @endif
                              </div>
                              <br>
                              <br>


                                <div class="col-md-4">
                                  Total harga dibayarkan
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                                @if($order->invoice_detail_payment=="")
                              <label>Belum dibayarkan</label>
                                @else
                              <label>Rp {{number_format($order->invoice_detail_payment,0,'.','.')}}</label>
                                @endif
                              </div>
                              <br>
                              <br>

                                <div class="col-md-4">
                                  Kekurangan
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                                @if($order->invoice_detail_payment=="")
                              <label>Belum diketahui</label>
                                @else
                              <label>Rp {{number_format($order->invoice_total_payment-$order->invoice_total_payment,0,'.','.')}}</label>
                                @endif
                              </div>
                              <br>
                              <br>

                                 <div class="col-md-4">
                                  Status pembayaran
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$order->invoice_status}}</label>
                              </div>
                              <br>
                              <br>


                              <?php
                              $comment = DB::table('sys_order_comment')
                                    ->where('order_comment_order_id','=',$order->order_id)
                                    ->orderby('order_comment_date','DESC')
                                    ->first();

                              $commentcount = DB::table('sys_order_comment')
                                    ->where('order_comment_order_id','=',$order->order_id)
                                    ->orderby('order_comment_date','DESC')
                                    ->count();

                              ?>

                             <div class="col-md-4">
                                  Status desc (Comment)
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>
                                @if($commentcount==0)
                                  Tidak ada komentar
                                @else
                                {{$comment->order_comment_desc}}</label>
                                @endif
                              </div>
                              <br>
                              <br>

                               <div class="col-md-4">
                                  Proggres pengerjaan
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                                     
                                      <div class="row">
                                        <div class="col-lg-4">
                                          Jumlah
                                        </div>
                                        <div class="col-md-1">
                                          :
                                        </div>
                                        <div class="col-lg-6">
                                      <label>{{$order->order_qty.' '.$order->order_qty_unit}}</label>
                                        </div>
                                      </div>
                                      <div class="row">
                                        <div class="col-lg-4">
                                        Selesai
                                        </div>
                                        <div class="col-md-1">
                                          :
                                        </div>
                                        <div class="col-lg-6">
                                          <label>{{$total->order_progress_qty_finished.' '.$progress->order_qty_unit}}</label>
                                        </div>
                                      </div>
                                      <div class="row">
                                        <div class="col-lg-4">
                                        Terkirim
                                        </div>
                                        <div class="col-md-1">
                                          :
                                        </div>
                                        <div class="col-lg-6">
                                          <label>{{$total->order_progress_qty_delivered.' '.$progress->order_qty_unit}}</label>
                                        </div>
                                      </div>
                                      <div class="row">
                                        <div class="col-lg-4">
                                        Outstanding
                                        </div>
                                        <div class="col-md-1">
                                          :
                                        </div>
                                        <div class="col-lg-6">
                                          <label>{{$progress->order_qty-$total->order_progress_qty_finished.' '.$progress->order_qty_unit}}</label>
                                        </div>
                                      <br>
                                      <br>
                                      </div>
                              </div>
                              <br>
                              <br>


                            </div>
                            </div>
                            </div>

                            
                            
                         

                            <label>Data order</label>
                            <legend></legend>
                            <div class="row">
                            <div class="col-md-12">
                            <div class="row">
                              <div class="col-md-4">
                                  Tanggal order
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{date("d-M-Y",strtotime($order->order_date))}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Tanggal jadi
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                                @if($order->order_due_date=="")
                              <label>Belum ditentukan</label>
                                @else
                              <label>{{date("d-M-Y",strtotime($order->order_due_date))}}</label>
                                @endif
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Kode order
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$order->order_code}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Jenis order
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$ordername}}</label>
                              </div>
                              <br>
                              <br>
                           
                             

                            </div>
                            </div>
                            </div>
                           



                             <?php      
        if($order->order_name=='idcard'){
          $type = DB::table('sys_order_idcard')
                    ->where('order_idcard_order_id','=',$order->order_id)
                    ->first();
          $ordername = 'ID Card ('.$type->order_idcard_quality_name.')'; ?>

<label>Detail order</label>
        <legend></legend>
      <div class="row">
      <div class="col-md-12">
      <div class="row">
      <div class="col-md-4">
         Type ID Card
      </div>
      <div class="col-md-1">
      :
      </div>
      <div class="col-md-7">
      <label>{{$type->order_idcard_type_name}}</label>
      </div>
      <br>
      <br>
      <div class="col-md-4">
          Kualitas ID Card
      </div>
      <div class="col-md-1">
      :
      </div>
      <div class="col-md-7">
      <label>{{$type->order_idcard_quality_name}}</label>
      </div>
      <br>
      <br>
      <div class="col-md-4">
          Fitur tambahan
      </div>
      <div class="col-md-1">
      :
      </div>
      <div class="col-md-7">
      <?php $no = 1; 
        $detailorder =  DB::table('sys_order')
            ->join('sys_order_idcard','order_idcard_order_id','=','order_id')
            ->join('sys_order_idcard_detail','order_idcard_detail_order_idcard_id','=','order_idcard_id')
            ->join('ref_additional_features','order_idcard_detail_idcard_additional_features_id','=','additional_features_id')
            ->where('order_id','=',$order->order_id)
            ->get();
      ?>
      @foreach($detailorder as $addfeature)
      <label>{{$no}}. {{$addfeature->additional_features_name}}</label><br>
      <?php $no++; ?>
      @endforeach
      </div>
      <br>
      <br>
      <br>
    </div>
    </div>
    </div>




     <?php   }
        else if($order->order_name=='packaging'){
          $type = DB::table('sys_order_packaging')
                    ->where('order_packaging_order_id','=',$order->order_id)
                    ->first();
          $ordername = 'Packaging ('.$type->order_packaging_type.')'; ?>
 <br>
                            <label>Detail order</label>
                            <legend></legend>
                                <div class="row">
                                <div class="col-md-12">
                                <div class="row">
                                <div class="col-md-4">
                                   Type packaging
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$ordername}}</label>
                                </div>
                                <br>
                                <br>
                                <div class="col-md-4">
                                    Ukuran (Dimensi)
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$type->order_packaging_size}}</label>
                                </div>
                                <br>
                                <br>
                                <div class="col-md-4">
                                    Jenis kertas
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$type->order_packaging_paper}} Cm</label>
                                </div>
                               
                                <br>
                                <br>
                                <br>
                              </div>
                              </div>

                            </div>



       <?php }
        else if($order->order_name=='brochure'){
          $type = DB::table('sys_order_brochure')
                        ->where('order_brochure_order_id','=',$order->order_id)
                        ->first();
          if($type->order_brochure_type=="brochure"){
          $ordername = 'Brosur (Brosur '.$type->order_brochure_color.' '.$type->order_brochure_qty_print_page.')';
          }else if($type->order_brochure_type=="envelope"){
          $ordername = 'Brosur (Amplop '.$type->order_brochure_color.' '.$type->order_brochure_qty_print_page.')';
          }else if($type->order_brochure_type=="flayer"){
          $ordername = 'Brosur (Flayer '.$type->order_brochure_color.' '.$type->order_brochure_qty_print_page.')';
          }else if($type->order_brochure_type=="letterhead"){
          $ordername = 'Brosur (Kop Surat '.$type->order_brochure_color.' '.$type->order_brochure_qty_print_page.')';
          } ?>

           <br>
                            <label>Detail order</label>
                            <legend></legend>
                                <div class="row">
                                <div class="col-md-12">
                                <div class="row">
                                <div class="col-md-4">
                                   Type brochure
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$ordername}}</label>
                                </div>
                                <br>
                                <br>
                                <div class="col-md-4">
                                    Ukuran (Dimensi)
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$type->order_brochure_size}}</label>
                                </div>
                                <br>
                                <br>
                                <div class="col-md-4">
                                    Jenis kertas
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$type->order_brochure_papertype}}</label>
                                </div>
                               
                                <br>
                                <br>
                                <br>
                              </div>
                              </div>

                            </div>


      <?php  }
        else if($order->order_name=='nota'){
          $type = DB::table('sys_order_bill')
                        ->where('order_bill_order_id','=',$order->order_id)
                        ->first();
          $ordername = $type->order_bill_name;?>

  <label>Detail order</label>
                            <legend></legend>
                                <div class="row">
                                <div class="col-md-12">
                                <div class="row">
                                <div class="col-md-4">
                                   Type nota
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$ordername}}</label>
                                </div>
                                <br>
                                <br>
                                <div class="col-md-4">
                                    Ukuran (Dimensi)
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$type->order_bill_size}}</label>
                                </div>
                                <br>
                                <br>
                                <div class="col-md-4">
                                    Jenis kertas
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$type->order_bill_papertype}}</label>
                                </div>
                               
                                <br>
                                <br>
                                <br>
                              </div>
                              </div>

                            </div>



        <?php }
        else if($order->order_name=='tshirt'){
           $type = DB::table('sys_order_tshirt')
                        ->join('ref_tshirt_detail','tshirt_detail_id','=','order_tshirt_tshirt_id')
                        ->join('ref_tshirt','tshirt_id','=','tshirt_detail_tshirt_id')
                        ->where('order_tshirt_order_id','=',$order->order_id)
                        ->first();
          $ordername = 'T-Shirt ('.$type->tshirt_type_of_material.')';?>
<label>Detail order</label>
        <legend></legend>
      <div class="row">
      <div class="col-md-12">
      <div class="row">
      <div class="col-md-4">
         Jenis bahan
      </div>
      <div class="col-md-1">
      :
      </div>
      <div class="col-md-7">
      <label>{{$type->tshirt_type_of_material}}</label>
      </div>
      <br>
      <br>
      <div class="col-md-4">
          Fitur tambahan
      </div>
      <div class="col-md-1">
      :
      </div>
      <div class="col-md-7">
      <?php $no = 1; 
        $detailorder =  DB::table('sys_order')
            ->join('sys_order_tshirt','order_tshirt_order_id','=','order_id')
            ->join('sys_order_tshirt_detail','order_tshirt_detail_order_tshirt_id','=','order_tshirt_id')
            ->join('ref_additional_features','order_tshirt_detail_additional_features_id','=','additional_features_id')
            ->where('order_id','=',$order->order_id)
            ->get();
      ?>
      @foreach($detailorder as $addfeature)
      <label>{{$no}}. {{$addfeature->additional_features_name}}</label><br>
      <?php $no++; ?>
      @endforeach
      </div>
      <br>
      <br>
      <br>
    </div>
    </div>
    </div>



       <?php } ?>

      

<br>
              </div>
              </div>
              </div>
              @endif



      
     </div>
  </div>
</div> 
 

@stop
@stop
     